using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Zoo;

public partial class Register : PageBase,IRegisterView
{
    private  RegisterController controller;
    public event EventHandler Subscribe;

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        IZooModel model = new ZooModel();
        controller = new RegisterController(this, model);
        
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        controller.Initialize();
        Page.DataBind();
    }

    #region Implement IRegisterView 

    public ListItemCollection LanguageValues
    {
        get
        {
            return RblLanguage.Items;
        }
        set
        {

            Utility.CopyListItem(value,RblLanguage.Items);
        }
    }

    public ListItemCollection GenderValues
    {
        get
        {
            return RblGender.Items;
        }
        set
        {
            Utility.CopyListItem(value, RblGender.Items);
        }
    }

   

    public ListItemCollection SeekingValues
    {
        get
        {
            return RblSeeking.Items;
        }
        set
        {
            Utility.CopyListItem(value, RblSeeking.Items);
        }
    }

    

    public ListItemCollection DayValues
    {
        get
        {
            return DdlBornDateDay.Items;
        }
        set
        {
            Utility.CopyListItem(value, DdlBornDateDay.Items);
        }
    }

    public ListItemCollection MonthValues
    {
        get
        {
            return DdlBornDateMonth.Items;
        }
        set
        {
            Utility.CopyListItem(value, DdlBornDateMonth.Items);
        }
    }

    public ListItemCollection YearValues
    {
        get
        {
            return DdlBornDateYear.Items;
        }
        set
        {
            Utility.CopyListItem(value, DdlBornDateYear.Items);
        }
    }


    public string UserLanguage
    {
        get
        {
            return RblLanguage.SelectedValue;
        }
        set
        {
            Utility.SetSelectedItem(RblLanguage, value.ToString());
        }
    }

    public string NickName
    {
        get
        {
            return TxtNickName.Text;
        }
        set
        {
            TxtNickName.Text = value;
        }
    }

    public string EmailAddress
    {
        get
        {
            return TxtEmailAddress.Text;
        }
        set
        {
            TxtEmailAddress.Text = value;
        }
    }

    public string Gender
    {
        get
        {
            return RblGender.SelectedValue; 
        }
        set
        {
            Utility.SetSelectedItem(RblGender, value.ToString());
        }
    }

    public string Seeking
    {
        get
        {
            return RblSeeking.SelectedValue;
        }
        set
        {
            Utility.SetSelectedItem(RblSeeking, value.ToString());
        }
    }   

    public string City
    {
        get
        {
            return TxtCity.Text;
        }
        set
        {
            TxtCity.Text = value;
        }
    }


    public string Description
    {
        get
        {
            return TxtDescription.Text;
        }
        set
        {
            TxtDescription.Text = value;
        }
    }

    public int BornDateDay
    {
        get
        {
            return int.Parse(DdlBornDateDay.SelectedValue);
        }
        set
        {
            Utility.SetSelectedItem(DdlBornDateDay, value.ToString()); ;
        }
    }

    public int BornDateMonth
    {
        get
        {
            return int.Parse(DdlBornDateMonth.SelectedValue);
        }
        set
        {
            Utility.SetSelectedItem(DdlBornDateMonth, value.ToString()); ;
        }
    }

    public int BornDateYear
    {
        get
        {
            return int.Parse(DdlBornDateYear.SelectedValue);
        }
        set
        {
            Utility.SetSelectedItem(DdlBornDateYear, value.ToString()); ;
        }
    }

    public string ErrorMessage
    {
        get
        {
            return LblErrorMessage.Text;
        }
        set
        {
            LblErrorMessage.Text = value;
        }
    }

    public string Password
    {
        get
        {
            return TxtPassword.Text;
        }
        set
        {
            TxtPassword.Text = value;
        }
    }

    public bool EmailOptin
    {
        get
        {
            return ChbEmailOptin.Checked;
        }
        set
        {
            ChbEmailOptin.Checked = value;
        }
    }

    public bool HasFile
    {
        get { return FupPicture.HasFile; }
    }

    public byte[] FileContent
    {
        get { return FupPicture.FileBytes; }
    }

    public string PicturesRootPath
    {
        get { return Request.ApplicationPath + @"\Pictures\"; }
    }
 

    
    protected virtual void OnSubscribe(object sender, EventArgs e)
    {
        if (Subscribe != null)
            Subscribe(this, e);
    }

    protected void BtnSubscribe_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            OnSubscribe(sender, e);
        }
    }

    public int CountryID
    {
        get
        {
            return LocalizationControl1.CountryID;
        }
        set
        {
            LocalizationControl1.CountryID = value;
        }
    }

    public int RegionID
    {
        get
        {
            return LocalizationControl1.RegionID;
        }
        set
        {
            LocalizationControl1.RegionID = value;
        }
    }

    #endregion
}
